import { http } from '@/utils/https'

type LoginParams = {
  code: string
  encryptedData: string
  iv: string
}
/**
 * 小程序登录需要认证才能进行唤起登录的弹框
 * 获取手机号功能**目前针对非个人开发者**，所以个人开发者无法唤起获取手机号界面
 *  [详见文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html)
 * @param data 请求参数
 */
export const postLoginWxMinAPI = (data: LoginParams) => {
  return http({
    method: 'POST',
    url: '/login/wxMin',
    data,
  })
}

interface Simple {
  phoneNumber: string
}

export const postLoginWxMinSimpleApi = (data: Simple) => {
  return http({
    method: 'POST',
    url: '/login/wxMin/simple',
    data,
  })
}
